package com.gitee.xmhzzz.component.common.dto;



import com.gitee.xmhzzz.component.common.enums.ResponseCode;
import com.gitee.xmhzzz.component.common.exception.AbstractBusinessException;

import java.io.Serializable;

/**
  * @ClassName
  * @Description
  * @Author wzq
  * @Date 2023/12/15 17:04
  * @Version 1.0
  */
public class BaseRes implements Serializable
{

    private static final long serialVersionUID=1L;
    private Integer code;

    private String desc;


    public BaseRes()
    {
        this.code = ResponseCode.SUCCESS.getCode();
        this.desc = ResponseCode.SUCCESS.getMsg();
    }

    public BaseRes(AbstractBusinessException exception)
    {
        this.code = exception.getResponseCode();
        this.desc = exception.getMessage();
    }


    public BaseRes(Integer code, String msg) {
        this.code = ResponseCode.of(code).getCode().intValue();
        this.desc = msg;
    }
    public int getCode()
    {
        return code;
    }

    public void setCode(int code)
    {
        this.code = code;
    }

    public String getDesc()
    {
        return desc;
    }

    public void setDesc(String desc)
    {
        this.desc = desc;
    }
    
}
